package cn.gailvlun.gll.presentation.profile;

import android.content.Context;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;

import cn.gailvlun.gll.R;
import cn.gailvlun.gll.databinding.ActivityAccountBinding;
import cn.gailvlun.gll.net.base.Profile;
import cn.gailvlun.gll.presentation.base.BaseActivity;
import cn.gailvlun.gll.presentation.login.ForgotPasswordActivity;
import cn.gailvlun.gll.util.ProfileUtil;
import cn.gailvlun.gll.widget.NavigationBarView;



public class AccountActivity extends BaseActivity {

    public static void openActivity(Context context) {
        Intent intent = new Intent(context, AccountActivity.class);
        context.startActivity(intent);
    }

    private ActivityAccountBinding mBinding;

    @Override
    protected void initComponent() {
        mBinding = DataBindingUtil.setContentView(this, R.layout.activity_account);
        mBinding.setPresenter(new Presenter());
    }

    @Override
    protected void createHandler() {
        mBinding.nbv.setOnBackListener(new NavigationBarView.OnBackListener() {
            @Override
            public void onBack(NavigationBarView nb) {
                onBackPressed();
            }
        });
    }

    @Override
    protected void loadData(@Nullable Bundle savedInstanceState) {
        Profile profile = ProfileUtil.getProfile();
        if (profile != null) {
            mBinding.tvPhone.setText(profile.getMobile());
        }
    }

    public class Presenter {
        public void onModifyPassword() {
            ForgotPasswordActivity.openActivity(mContext);
        }
    }
}
